package com.google.gwt.sample.dynatablerf.client.presenters;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.sample.dynatablerf.client.events.GoToProjetoListEvent;

public class StartPresenter extends AbstractTabPresenter {

	public interface StartDisplay extends TabDisplay {

		HasClickHandlers getGoToProjetListClickHandlers();
	}

	private StartDisplay startDisplay;

	public StartPresenter(StartDisplay startDisplay, EventBus eventBus) {
		super(eventBus);
		this.startDisplay = startDisplay;
	}

	@Override
	protected void bind() {
		startDisplay.getGoToProjetListClickHandlers().addClickHandler(
				new ClickHandler() {

					@Override
					public void onClick(ClickEvent event) {
						getEventBus().fireEvent(
								new GoToProjetoListEvent(getTabLayoutPanel()));

					}
				});
	}

	@Override
	protected TabDisplay getTabDisplay() {
		return startDisplay;
	}

}
